import java.util.Arrays;
import java.util.Scanner;

public class lianXi102 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.print("请输入班级数:");
        int a = input.nextInt();//a表示有多少班级数

        boolean flag = true;
        int[] num = new int[1];
        int[] avg = new int[a];

        do {int i;
            for (i=0; i < a; i++) {
                int sum = 0;
                System.out.println("请输入第" + (i+1) + "个班级的人数:");
                int b = input.nextInt();
                int[][] scoses = new int[a][b];
                for (int j = 0; j < i; j++) {
                    System.out.println("请输入第" + (i+1) + "个班级的第" + (j + 1) + "位同学的成绩:");
                    scoses[i][j] = input.nextInt();
                    sum += scoses[i][j];
                    continue;
                }
                num = Arrays.copyOf(num, num.length + i + 1);
                num[i] += b;
                avg[i] = (sum / b);
            }
            if (i == a) {
                flag = false;
            }
        }while (flag);

        for (int i=0;i<a;i++){
            System.out.println("第"+(i+1)+"个班总共有"+num[i]+"人，的平均成绩是:"+avg[i]);
        }
    }
}

